<#assign menu="article">
<#assign submenu="update_article">
<#include "/system/head.ftl">
<!--main content start-->
<style type="text/css">

</style>
<section id="main-content">
	<section class="wrapper">
		<!-- page start-->
		<form id="update_article_form" class="form-horizontal" action="${basePath}/admin/article/update.json"  autocomplete="off"  method="post"
			enctype="multipart/form-data">
		<div class="row">
			<div class="col-lg-12">
				<section class="panel">
					<header class="panel-heading"> 
						修改文章
					</header>
					<div class="panel-body">
					<input type="hidden" name="articleEntity.articleId" value="${articleEntity.articleId?c}" id="articleId" />
						<div class="form-group">
                          <label class="col-sm-2 col-sm-2 control-label">文章标题</label>
                          <div class="col-sm-10">
                              <input type="text" style="font-size:15px;width: 300px;" class="form-control" name="articleEntity.title"
                              	placeholder="文章标题" id="title" value="${articleEntity.title}" >
                              </input>
                          </div>
                        </div>
                        <div class="form-group">
                          <label class="col-sm-2 col-sm-2 control-label">所属栏目</label>
                          <div class="col-sm-10">
                              <select class="form-control" id="classId" name="articleEntity.classId" style="font-size:15px;width: 300px;">
			                   		<#list classesList as classes>
			                   			<option style="background-color:#DFF0D8;font-weight:bold;" value="${classes.id}" selected>${classes.name}</option>
			                   		</#list>						
	                            </select>			
                          </div>
                        </div>  
                        <div class="form-group">
                          <label class="col-sm-2 col-sm-2 control-label">摘要</label>
                          <div class="col-sm-10">
                              <input type="text" style="font-size:15px;" class="form-control" id="description" name="articleEntity.description"
                              	placeholder="摘要" id="summary" value="${articleEntity.description}" >
                              </input>
                          </div>
                        </div>                                              
						<div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label">文章内容</label>
                              <div class="col-sm-10">
                                  <script id="content" name="content" type="text/plain"
										style="width: 100%; height: 260px;">${articleEntity.content!}</script>
								  <script type="text/javascript">
									var contentEditor;
									$(function() {
										contentEditor = UE.getEditor('content');
									});
								  </script>
                              </div>
                        </div>
                     
                        <div class="form-group">
                          <label class="col-sm-2 col-sm-2 control-label">文章状态</label>
                          <div class="col-sm-10" style="margin-bottom:10px;">
                          	<input name="articleEntity.status" id="status" value="1" type="radio" <#if (articleEntity.status=="1")>checked</#if>> 显示
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input name="status" value="0" type="radio" <#if (articleEntity.status=="0")>checked</#if>> 隐藏
                          </div>
                        </div>
                        <div class="form-group">
                      	  <div class="col-lg-offset-2 col-lg-10">
                          <button class="btn btn-shadow btn-primary" type="submit">修改</button>
                          </div>
                      </div>
					</div>
				</section>
			</div>
		</div>
		</form>
		<!-- page end-->
	</section>
</section>
<!--main content end-->
<script type="text/javascript">
$(function(){
	$('#update_article_form').ajaxForm({
		dataType : 'json',
		success : function(data) {
			if (data.result) {
				bootbox.alert("保存成功，将刷新页面", function() {
					window.location.reload();
					
				});
			}else{
				showErrors($('#add_article_form'),data.errors);
			}
		},
		error:function(data,textstatus){
	        bootbox.alert({  
	            buttons: {  
	               ok: {  
	                    label: '关闭'
	               }  
	            },
	            message: data.responseText,
	            title: '<@spring.message "system.errorTip"/>',  
	        });
	     } 
	});
});
</script>
<#include "/system/foot.ftl">
